<template>
    <div>
        <el-form :label-position="labelPosition" label-width="80px" :model="formLabelAlign" ref="formLabelAlign">
        <el-form-item label="店铺名称">
        <el-input v-model="formLabelAlign.market_name"></el-input>
        </el-form-item>
        <el-form-item label="店铺类型">
        <el-input v-model="formLabelAlign.market_type"></el-input>
        </el-form-item>
        <el-form-item label="店铺老板">
        <el-input v-model="formLabelAlign.market_author"></el-input>
        </el-form-item>
        <el-form-item label="店铺手机">
        <el-input v-model="formLabelAlign.market_phone"></el-input>
        </el-form-item>
        <el-form-item label="店铺邮箱">
        <el-input v-model="formLabelAlign.market_email"></el-input>
        </el-form-item>
        <el-form-item>
        <el-button type="primary" @click="submitForm">修改</el-button>
        <el-button @click="resetForm('formLabelAlign')">重置</el-button>
        </el-form-item>
        </el-form>
    </div>
</template>
<script>
  export default {
    data() {
      return {
        labelPosition: 'right',
        formLabelAlign: {
          market_id:this.$route.params.market_id,
          market_name: this.$route.params.market_name,
          market_type:this.$route.params.market_type,
          market_author:this.$route.params.market_author,
          market_phone: this.$route.params.market_phone,
          market_email:this.$route.params.market_email
        }
      };
    },
    methods:{
         resetForm(formName) {
            this.$refs[formName].resetFields();
        },
        submitForm(){
            this.axios.post("/api/shopping/modifyShop.php",this.formLabelAlign).then(res=>{
                if(res.data=="ok"){
                    this.$message({
                        type:'success',
                        message:'修改成功'
                    });
                }else{
                    this.$message({
                        type:'success',
                        message:'服务器繁忙'
                    });
                }
            });
        }
    }
  }
</script>